<?php

namespace app\admin\controller\setting;

use app\admin\controller\AdminController;
use app\admin\service\setting\SystemService;
use think\response\Json;

/**
 * 系统维护
 */
class System extends AdminController
{

    /**
     * 获取系统环境信息
     * @return Json
     */
    public function sysInfo()
    {
        $result = SystemService::getInfo();
        return $this->data($result);
    }

    /**
     * 获取系统消息列表
     * @return Json
     */
    public function sysMessageList()
    {
        $result = SystemService::getMessageList($this->getData());
        return $this->data($result);
    }

    /**
     * 清除系统缓存
     * @return Json
     */
    public function clearCache()
    {
        $type = request()->post('type');
        SystemService::clear($type);
        return $this->data([]);
    }
}